package Items.Top01.Lease;

import java.util.Scanner;

public class Business {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        Manager manager=new Manager();
        System.out.println();
        System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
        System.out.println("金路至尊租赁有限公司欢迎您，请致电138-2500-0250洽谈相关业务");
        System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
        System.out.println("本公司现有"+manager.getPos()+"辆车可租赁");
        while (true){
            System.out.println("1.查看车辆信息\t2.租赁\t3.还车\t4.报废\t5.采购新车\t6.查看租赁记录\t9.退出");
            int choice=in.nextInt();
            if (choice==1){
                manager.showCarList();
            }else if (choice==2){
                System.out.println("提示：只显示为被租借车辆");
                System.out.println("请输入要租赁的车型(大客\t轿车)");
                String cartype=in.next();
                for (int i = 0; i < manager.getPos(); i++) {
                    if (manager.cars[i].isState()) {
                        continue;
                    }
                    /*if (in.nextInt()==1){
                        System.out.println(manager.cars[i]);
                    }else if (in.nextInt()==2){
                        System.out.println(manager.cars[i]);
                    }*/
                    if (manager.cars[i].getModel().equals(cartype)){
                        System.out.println(manager.cars[i]);
                    }else{
                        System.out.println("无法找到此类型车辆");
                    }
                }
                System.out.println("请输入要租借的车牌号：");
                String carNum=in.next();
                System.out.println("请输入租借天数:");
                int days=in.nextInt();
                Car car=manager.lease(cartype,carNum,days);
                if (carNum.equals(car.getCarNum())){
                    System.out.println("您租的是"+car.toString());
                }else {
                    System.out.println("租借失败，牌照无法查询");
                    break;
                }

            }else if (choice==3){
                System.out.println("请输入要归还的车辆牌照");
                String carnum1=in.next();
                manager.returnCar(carnum1);
            }else if (choice==4){
                System.out.println("请输入要报废车辆牌照");
                manager.delCar(in.next());
            }else if (choice==5){
                System.out.println("请输入要采购车型(1.大客\t2.轿车)");
                if (in.nextInt()==1){
                    Car car1 =new PassengerCar();
                    System.out.println("请输入车牌号：");
                    car1.setCarNum(in.next());
                    System.out.println("请输入车辆型号：");
                    car1.setBrand(in.next());
                    System.out.println("请输入座位数：");
                    car1.setSeatNum(in.nextInt());
                    System.out.println("请设定此车租金：");
                    car1.setRent(in.nextDouble());
                    manager.add(car1);
                    System.out.println("车辆添加成功");
                }else if(in.nextInt()==2){
                    Car car2=new LittleCar();
                    System.out.println("请输入车牌号：");
                    car2.setCarNum(in.next());
                    System.out.println("请输入车辆型号：");
                    car2.setBrand(in.next());
                    System.out.println("请输入座位数：");
                    car2.setSeatNum(in.nextInt());
                    System.out.println("请设定此车租金：");
                    car2.setRent(in.nextDouble());
                    manager.add(car2);
                    System.out.println("车辆添加成功");
                }
            }else if (choice==6){
                System.out.println("此功能未开发");
            }else if (choice==9){
                    break;
            }
            }
            System.out.println("感谢光临并支持本公司及业务");
        }
    }

